<template>
    <div class="swiper-container">
    <div class="swiper-wrapper">
        <div class="swiper-slide">
            <img src="../assets/images/1.jpg" alt="5">
        </div>
        <div class="swiper-slide">
            <img src="../assets/images/2.jpg" alt="22">
        </div>
        <div class="swiper-slide">
            <img src="../assets/images/3.jpg" alt="55">
        </div>
        <div class="swiper-slide">
            <img src="../assets/images/4.jpg" alt="55">
        </div>
    </div>
    <!-- 如果需要分页器 -->
    <div class="swiper-pagination"></div>
   
</div>
</template>

<script>
import '../assets/styles/swiper.min.css'
import Swiper from "swiper";
export default {
    components:{
        Swiper
    },
    name: "Slider",
    mounted(){      
        new Swiper ('.swiper-container', {
        pagination: {
        el: '.swiper-pagination',
        },
        autoplay:true   
      })
    }
    }



</script>

<style lang="stylus" scoped>
/* 样式穿透>>>vue引用了第三方组件，需要在组件中局部修改第三方组件的样式，而又不想去除scoped属性造成组件之间的样式污染。此时只能通过>>>，穿透scoped。 */
.swiper-container>>>.swiper-pagination-bullet-active{
    background white !important
}
.swiper-container{
    margin-top 0.6rem;
    width 100%;
    height 3rem;
    .swiper-wrapper{
        .swiper-slide{
            img{
                width 100%;
                height 3rem;
                }
            }
        }
    }
</style>


